/*
 * Copyright 2010-2011 ESunny.com All right reserved. This software is the confidential and proprietary information of
 * ESunny.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with ESunny.com.
 */
package com.xjt.query.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.xjt.exception.XjtSqlException;
import com.xjt.query.dao.CommonDao;
import com.xjt.query.service.interf.QueryListService;

/**
 * 查询列表业务类
 * 
 * @author Jet Xu 2012-7-27 上午10:12:50
 */
public class QueryListServiceImpl implements QueryListService {

    @Autowired
    private CommonDao commonDao;

    @Override
    public int countQueryResult(String countSql, Map<String, Object> params) {
        try {
            return commonDao.queryForIntWithSql(countSql, params);
        } catch (XjtSqlException e) {
            // TODO Auto-generated method stub
            e.printStackTrace();
            return 0;
        }
    }

    @Override
    public List<Map<String, Object>> queryList(String querySql, Map<String, Object> params) {
        try {
            return commonDao.queryForListWithSql(querySql, params, null);
        } catch (XjtSqlException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return null;
        }
    }

}
